<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>所有单位--办结项目</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/lib/layui/css/layui.css">
    <link rel="stylesheet" href="/static/css/weadmin.css">
    <script type="text/javascript" src="/templates/act/process-xl.js"></script>
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body>
<form class="layui-form searchForm" action="">
    查询:
    <div class="layui-input-inline">
        <input style="width:200px;" type="text" name="prjName" placeholder="项目名称/申报编号" autocomplete="off"
               class="layui-input">
        <!-- <input style="width:200px;" type="text" name="declareCode" placeholder="申报编号" autocomplete="off"
                class="layui-input">-->
    </div>
    <button class="layui-btn" lay-submit lay-filter="formDemo">查询</button>
    <button class="layui-btn" lay-submit lay-filter="formClear">清空</button>
</form>
<table class="layui-hide" id="dataList" lay-filter="dataList"></table>

<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="{{d.taskDefKey}}">详情</a>
</script>

<script type="text/javascript" src="/lib/layui/layui.js"></script>
<script src="/static/js/main.js"></script>
<script>
    var configureCom = {};
    layui.use(['jquery', 'configureCom', 'configure', 'sessionFun', 'table', 'matchDict'], function () {
        var $ = layui.jquery;
        var configure = layui.configure;
        var table = layui.table;
        var sessionFun = layui.sessionFun;
        var matchDict = layui.matchDict;
        configureCom = layui.configureCom;
        var iframeId = configureCom.GetQueryString('iframeId');//获得当前iframe页面的id
        var cols = [[
            {
                field: 'prjName', title: '建设项目名称', templet: function (d) {
                    return '<p>' + d.prjName  + '</p><p>申报编号:' + d.declareCode + '</p>';
                }
            },
            {field: 'buildCorpName', title: '建设单位'},
            {
                field: 'kcCorpName', title: '勘察设计单位', templet: function (d) {
                    return '<p>勘察单位:' + (d.kcCorpName || '-') + '</p><p>设计单位:' + (d.sjCorpName || '-') + '</p>';
                }
            },
            {field: 'checkOrgName', title: '审查机构'},
            {field: 'createTime', title: '完成时间'},
            {fixed: 'right', title: '操作', toolbar: '#barDemo', width: 120}
        ]];
        configureCom.tableRender(configure.PROJECT_COMPLETE_LIST_HTTP, {}, cols, 'dataList', 10);

        //每行操作
        table.on('tool(dataList)', function (obj) {
            var data = obj.data;
            sessionFun.set(configure.SESSION_PROJECT_LIST_DATA, data);
            configureCom.postDataAjax(configure.PROJECT_APPLY_DETAIL_INFO_HTTP, {decId: data.decId}).then(function (res) {
                var listData = $.extend(data, res.prjDeclare);//将查出的申报信息和当前列表混合
                sessionFun.set(configure.SESSION_PROJECT_WAIT_LIST_DATA, listData);
                switch (obj.event) {
                    //遴选完后的遴选记录
                    case configure.ZFLX_YB:
                        editItem('查看详情', configure.HAS_DEAL_SELECTION_HTML);//查看待办列表详情
                        break;
                    //审图办查看合同
                    case configure.STBCKHT_YB:
                        editItem('查看详情', configure.HAS_DEAL_CONTRACT_HTML);//查看待办列表详情
                        break;
                    default:
                        editItem('查看详情', configure.HAS_DEAL_DETAIL);//查看待办列表详情
                        break;
                }
            });
        });

        /**
         * 新增或修改字典详情
         * @title 弹框标题
         * @htmlUrl 弹窗页面地址
         * **/
        function editItem(title, htmlUrl) {
            top.layer.open({
                type: 2,
                title: title,
                area: configureCom.Psize1,
                content: configureCom.nocache(htmlUrl, iframeId),
                success: function (layero, index) {
                    top.layer.full(index);
                },
                end: function () {
                    configureCom.tableReload();
                }
            });
        }

        //监听搜索
        configureCom.tableSearch();


    });
</script>
</body>
</html>